var userInfomation,userInfoObj;
var userName = '';
var userSex = '';
var userBirth = '';
var userPhone = '';
var userEmail = '';
mui.init();

mui.plusReady(function() {
	userInfomation = localStorage.getItem("userInfo");
	userInfoObj = JSON.parse(userInfomation);
	alert(userInfoObj);
	userName = userInfoObj.userName;
	userSex = userInfoObj.sex;
	userBirth = userInfoObj.birthday;
	userPhone = userInfoObj.mobilePhone;
	userEmail = userInfoObj.email;
	if(userName !== null && userName !== '') {
		mui('#userName').innerText = userName;
		mui('#avtarName').innerText = userName;
	}
	if(userSex !== null && userSex !== '') {
		mui('#userSex').innerText = userSex;
	}
	if(userBirth !== null && userBirth !== '') {
		mui('#userBirth').innerText = userBirth;
	}
	if(userPhone !== null && userPhone !== '') {
		mui('#userPhone').innerText = userPhone;
	}
	if(userEmail !== null && userEmail !== '') {
		mui('#userEmail').innerText = userEmail;
	}
});

//波浪线
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

requestAnimFrame = (function() {
	return function(callback) {
		setTimeout(callback, 18);
	};
})();

//初始角度为0  
var step = 90;
//定义三条不同波浪的颜色  
var lines = ["112,153,249, 0.7)",
	"rgba(112,153,249, 0.5)",
	"rgba(112,153,249, 0.7)",
	"rgba(112,153,249, 0.5)"
];

function loop() {
	ctx.clearRect(0, 0, canvas.width, canvas.height);
	step++;
	//画3个不同颜色的矩形  
	for(var j = lines.length - 1; j >= 0; j--) {
		ctx.fillStyle = lines[j];
		//每个矩形的角度都不同，每个之间相差45度  
		var angle = (step + j * 90) * Math.PI / 180;
		var deltaHeight = Math.sin(angle) * 50 + 30;
		var deltaHeightRight = Math.cos(angle) * 50 + 30;
		ctx.beginPath();
		ctx.moveTo(0, canvas.height / 2 + deltaHeight);
		ctx.bezierCurveTo(canvas.width / 2, canvas.height / 2 + deltaHeight, canvas.width / 2, canvas.height / 2 + deltaHeightRight, canvas.width, canvas.height / 2 + deltaHeightRight);
		ctx.lineTo(canvas.width, canvas.height);
		ctx.lineTo(0, canvas.height);
		ctx.lineTo(0, canvas.height / 2 + deltaHeight);
		ctx.closePath();
		ctx.fill();
	}
	requestAnimFrame(loop);
}
loop();